﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace KeyValuePair
{
    /// <summary>
    /// Class for pairs key-value
    /// </summary>
    public class MyKeyValuePair : IEquatable<MyKeyValuePair>
    {
        #region Constructors

        /// <summary>
        /// Initialize new instance
        /// </summary>
        /// <param name="key">Key</param>
        /// <param name="value">Value</param>
        public MyKeyValuePair(int key, string value)
        {
            m_Key = key;
            m_Value = value;
        }

        #endregion

        #region Properties

        public int Key { get { return m_Key; } }
        public string Value { get { return m_Value; } }

        #endregion

        #region IEquatable<MyKeyValuePair> Implementation

        /// <summary>
        /// Compares current MyKeyValuePair with another one
        /// </summary>
        /// <param name="other">Another MyKeyValuePair</param>
        /// <returns>True - if two MyKeyValuePair objects are equal, otherwise - False</returns>
        public bool Equals(MyKeyValuePair other)
        {
            if (other != null && this.Key == other.Key && this.Value.Equals(other.Value))
                return true;

            return false;
        }       

        #endregion

        #region Private Fields

        private readonly int m_Key;
        private readonly string m_Value;

        #endregion
        
    }
}
